function func() {
  let a = "chengzhu";
  // b是一个求和函数
  let b = (x: number, y: number): number => x + y;
  return [a, b];
}

const [n, m] = func();
// 下行报错，因为n和m类型是any
// console.log(m(1, 2));

// 正确，断言了m是函数，等于我告诉他m是函数
console.log((m as Function)(1, 2));

// 第2种解构断言方式
const [a, b] = func() as [string, Function];
console.log(b(2, 3));

// 在返回的时候就断言
function func1() {
  let a = "zhangyun";
  // b是一个求和函数
  let b = (x: number, y: number): number => x + y;
  // 下面三行效果一样
  //   return [a, b] as [string, Function];
//   return [a, b] as [typeof a, typeof b];
    return [a, b] as const;
}
const [c, d] = [...func1()];
console.log(d(3, 99));
